package com.jiangcheng.demo.controller;

import com.jiangcheng.demo.qcloud.CosClient;
import io.swagger.annotations.Api;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;



@Controller
@RestController
public class TestUploadController {

    @PostMapping("/upload")
    public String upload(@Param("file") MultipartFile file) throws IOException {
        System.out.println(file);
        String originalFilename = file.getOriginalFilename();

        CosClient cosClientTest = new CosClient();
        String s = cosClientTest.uploadFile(file);
        System.out.println("path：" + s);
        return s;
    }

}
